package jmine.tec.web.wicket.component.menu;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.AbstractLink;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.link.Link;

/**
 * @author katsuo.ogawa
 * @date Jul 5, 2011
 */
public class MenuInternalLink extends MenuLink {

    private Class destination;

    /**
     * Construtor.
     * 
     * @param caption Descrição do link.
     * @param destination Pagina
     */
    public MenuInternalLink(String caption, Class destination) {
        super(caption);
        this.destination = destination;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AbstractLink getLink() {
        @SuppressWarnings("unchecked")
        Link link = new BookmarkablePageLink("link", this.destination);
        link.add(new Label("caption", this.getCaption()));
        return link;
    }

    /**
     * @return a Class referente à tela do link.
     */
    public Class getDestination() {
        return destination;
    }

}
